<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<script>
    $(function () {
        var upper = $("#upperDoctorId").val();
        var dire = $("#directorDoctorId").val();
        var doctor = $("#doctorInChargeId").val();
        selectedDoctor($("#deptStayed").val(), doctor,upper,dire);
    });
    function selectedDoctor(deptId,doctor, upper,dire){
        loadDoctorByDept(deptId, doctor,'doctorInCharge','${ctx}/sys/orgGroupVsDept/findUserByDeptId');
        loadDoctorByDept(deptId, upper,'upperDoctor','${ctx}/sys/orgGroupVsDept/findUserByDeptId');
        loadDoctorByDept(deptId, dire,'directorDoctor','${ctx}/sys/orgGroupVsDept/findUserByDeptId');
    }
</script>
<form:form id="inputForm" data-parsley-validate=""  modelAttribute="turnInVo" onsubmit="return formTurnOutLoad('mainCenterDiv','inputForm','${ctx}/doctor/medicalRecord/saveTurnOutPatient','${ctx}/doctor/patVisit/index');" method="post" class="form-horizontal">
        <form:hidden path="id"/>
        <form:hidden path="patientId"/>
        <form:hidden path="patVisitId"/>
        <form:hidden path="bedNo"/>
        <div class="form-group">
            <label class="col-sm-4 control-label">姓名：</label>
            <div class="col-sm-8">
                <form:input path="name" htmlEscape="false" class="form-control"  maxlength="32" readonly="true" data-parsley-required="true"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-4 control-label">性别：</label>
            <div class="col-sm-8">
                <form:select path="sex" id="sex" class="form-control" data-parsley-required="true"  disabled="true">
                    <form:options items="${fns:getDictList('SEX_DICT')}" itemLabel="label" itemValue="value"  htmlEscape="false"/>
                </form:select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-4 control-label">转出科室：</label>
            <div class="col-sm-8">
                <input readonly class="form-control" value="${fns:getDeptName(turnInVo.deptStayed,'' )}"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-4 control-label">转向科室：</label>
            <div class="col-sm-8">
                <sys:treeselect selectedParent="true" id="deptStayed"  method="selectedDoctor" name="deptStayed" value=""  update="false" labelName="" labelValue=""
                                title="科室" url="/sys/orgDept/treeData?clinicAttrs=0"  cssClass="form-control"  isnull="true"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-4 control-label">转出时间：</label>
            <div class="col-sm-8">
                <input class="form-control"  maxlength="20" readonly value="<fmt:formatDate value="${turnInVo.transferDate}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate>"/>
            </div>
        </div>
    <div class="form-group">
        <label class="col-sm-4 control-label">经治医生：</label>
        <div class="col-sm-8">
            <input type="hidden" value="${turnInVo.doctorInCharge}" id="doctorInChargeId">
              <form:select path="doctorInCharge" id="doctorInCharge" class="form-control" data-parsley-required="true" >
                  <form:option value="" label="请选择"></form:option>
              </form:select>
            <%--<select name="doctorInCharge" class="form-control">
                <c:forEach items="${users}" var="u">
                    <option value="${u.id}" <c:if test="${turnInVo.doctorInCharge eq u.id}" >selected</c:if>>${u.name}</option>
                </c:forEach>
            </select>--%>
        </div>
    </div>
        <div class="form-group">
            <label class="col-sm-4 control-label">上级医生：</label>
            <div class="col-sm-8">
                <input type="hidden" value="${turnInVo.upperDoctor}" id="upperDoctorId">
                <form:select path="upperDoctor" id="upperDoctor" class="form-control" data-parsley-required="true" >
                    <form:option value="" label="请选择"></form:option>
                </form:select>
              <%--  <select name="upperDoctor" class="form-control">
                    <c:forEach items="${users}" var="u">
                        <option value="${u.id}" <c:if test="${turnInVo.directorDoctor eq u.id}" >selected</c:if>>${u.name}</option>
                    </c:forEach>
                </select>--%>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-4 control-label">主任医生：</label>
            <div class="col-sm-8">
                <input type="hidden" value="${turnInVo.directorDoctor}" id="directorDoctorId">
                <form:select path="directorDoctor" id="directorDoctor" class="form-control" data-parsley-required="true" >
                    <form:option value="" label="请选择"></form:option>
                </form:select>
              <%--  <select name="directorDoctor" class="form-control">
                    <c:forEach items="${users}" var="u">
                        <option value="${u.id}" <c:if test="${turnInVo.directorDoctor eq u.id}" >selected</c:if>>${u.name}</option>
                    </c:forEach>
                </select>--%>
            </div>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <input id="btnSubmit" class="btn btn-primary" type="submit" value="确 定">&nbsp;
            <input id="btnCancel" class="btn" type="button" value="关 闭" onclick="closeTurnOutForm()"></div>
    </div>
</form:form>
